<!DOCTYPE html>
<html lang="zh_cn">
<head>
    <meta charset="utf-8" />
    <title>{:config("sys_name")}后台登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link href="__STATIC__/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="__STATIC__/assets/css/font-awesome.min.css" />

    <!--[if IE 7]>
    <link rel="stylesheet" href="__STATIC__/assets/css/font-awesome-ie7.min.css" />
    <![endif]-->
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" />

    <link rel="stylesheet" href="__STATIC__/assets/css/ace.min.css" />
    <link rel="stylesheet" href="__STATIC__/assets/css/ace-rtl.min.css" />
    <link rel="stylesheet" href="__STATIC__/assets/css/cltphp.css" />

    <!--[if lte IE 8]>
    <link rel="stylesheet" href="__STATIC__/assets/css/ace-ie.min.css" />
    <![endif]-->
    <!--[if lt IE 9]>
    <script src="__STATIC__/assets/js/html5shiv.js"></script>
    <script src="__STATIC__/assets/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="login-layout blur-login">
<div class="main-container">
    <div class="main-content">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <div class="login-container">
                    <div class="center">
                        <h1>
                            <i class="icon-leaf green"></i>
                            <span class="red">{:config("sys_name")}</span>
                            <span class="white">后台登录</span>
                        </h1>
                    </div>

                    <div class="space-6"></div>

                    <div class="position-relative">
                        <div id="login-box" class="login-box visible widget-box no-border">
                            <div class="widget-body">
                                <div class="widget-main">
                                    <h4 class="header blue lighter bigger">
                                        <i class="icon-coffee green"></i>
                                        请输入登录信息
                                    </h4>

                                    <div class="space-6"></div>

                                    <form name="runlogin" id="runlogin" method="post" action="{:url('action')}">
                                        <fieldset>
                                            <label class="block clearfix">
                                                <span class="block input-icon input-icon-right">
                                                    <input type="text" id="username" name="username" class="form-control" placeholder="用户名" />
                                                    <i class="icon-user"></i>
                                                </span>
                                            </label>

                                            <label class="block clearfix">
                                                <span class="block input-icon input-icon-right">
                                                    <input type="password" id="password" name="password" class="form-control" placeholder="密码" />
                                                    <i class="icon-lock"></i>
                                                </span>
                                            </label>

                                            <div class="space"></div>

                                            <div class="clearfix">
                                                <button type="submit" class="btn btn-sm btn-block btn-primary">
                                                    <i class="icon-key"></i>
                                                    登录
                                                </button>
                                            </div>

                                            <div class="space-4"></div>
                                        </fieldset>
                                    </form>
                                </div><!-- /widget-main -->
                            </div><!-- /widget-body -->
                        </div><!-- /Login-box -->
                    </div><!-- /position-relative -->
                </div>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div>
</div><!-- /.main-container -->

<!-- basic scripts -->
<script src="__STATIC__/assets/js/jquery.2.1.1.min.js"></script>
<script src="__STATIC__/assets/js/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script>
    //登入
    $(function(){
        $('#runlogin').ajaxForm({
            beforeSubmit: logcheckForm, // 此方法主要是提交前执行的方法，根据需要设置
            success: logcomplete, // 这是提交后的方法
            dataType: 'json'
        });
        function logcheckForm(){
            if( '' == $.trim($('#username').val())){
                layer.alert('登录用户名不能为空', {icon: 5}, function(index){
                    layer.close(index);
                    $('#username').focus();
                });
                return false;
            }

            if( '' == $.trim($('#password').val())){
                layer.alert('登录密码不能为空', {icon: 5}, function(index){
                    layer.close(index);
                    $('#pwd').focus();
                });
                return false;
            }
        }
        function logcomplete(data){
            if(data.status==1){
                window.location.href="{:url('Index/index')}";
                return false;
            }else{
                layer.alert(data.msg, {icon: 5});
                return false;
            }
        }

    });
</script>
</body>
</html>
